🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / feature / settings / src / androidMain / kotlin / org / meshtastic / feature / settings / tak / PrefExporter.kt
Displaying Raw • Download
feature/settings/src/androidMain/kotlin/org/meshtastic/feature/settings/tak/PrefExporter.kt bbef7670a13ecb0bbdd88f6a0ca886fc4bdb0e9a (bbef7670) Text, 2.21 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.settings.tak
Tff7b72import T7ee787android.content.Context
Tff7b72import T7ee787android.net.Uri
Tff7b72import T7ee787androidx.activity.compose.rememberLauncherForActivityResult
Tff7b72import T7ee787androidx.activity.result.contract.ActivityResultContracts
Tff7b72import T7ee787androidx.compose.runtime.Composable
Tff7b72import T7ee787androidx.compose.runtime.rememberCoroutineScope
Tff7b72import T7ee787androidx.compose.ui.platform.LocalContext
Tff7b72import T7ee787co.touchlab.kermit.Logger
Tff7b72import T7ee787kotlinx.coroutines.launch
Tff7b72import T7ee787kotlinx.coroutines.withContext
Tff7b72import T7ee787org.meshtastic.core.common.util.ioDispatcher
Tf0883e@Composable
Tff7b72actual Tff7b72fun Td2a8ffrememberDataPackageExporterTb4b4b4(Te6edf3dataPackageProviderTb4b4b4: Te6edf3suspend Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Te6edf3ByteArrayTb4b4b4)Tb4b4b4: Tb4b4b4(Te6edf3fileNameTb4b4b4: Tffa657StringTb4b4b4) Tff7b72-Tff7b72> Tffa657Unit Tb4b4b4{
Tff7b72val Te6edf3context Tff7b72= Te6edf3LocalContextTb4b4b4.Te6edf3current
Tff7b72val Te6edf3scope Tff7b72= Te6edf3rememberCoroutineScopeTb4b4b4(Tb4b4b4)
Tff7b72val Te6edf3exportLauncher Tff7b72=
Te6edf3rememberLauncherForActivityResultTb4b4b4(Te6edf3ActivityResultContractsTb4b4b4.Te6edf3CreateDocumentTb4b4b4(Ta5d6ff"Ta5d6ffapplication/zipTa5d6ff"Tb4b4b4)Tb4b4b4) Tb4b4b4{ Te6edf3createdUri Tff7b72-Tff7b72>
Tff7b72if Tb4b4b4(Te6edf3createdUri Tff7b72!Tff7b72= Tff7b72nullTb4b4b4) Tb4b4b4{
Te6edf3scopeTb4b4b4.Te6edf3launch Tb4b4b4{ Te6edf3exportZipToUriTb4b4b4(Te6edf3contextTb4b4b4, Te6edf3createdUriTb4b4b4, Te6edf3dataPackageProviderTb4b4b4(Tb4b4b4)Tb4b4b4) Tb4b4b4}
Tb4b4b4}
Tb4b4b4}
Tff7b72return Tb4b4b4{ Te6edf3fileName Tff7b72-Tff7b72> Te6edf3exportLauncherTb4b4b4.Te6edf3launchTb4b4b4(Te6edf3fileNameTb4b4b4) Tb4b4b4}
Tb4b4b4}
Tff7b72private Tff7b72suspend Tff7b72fun Td2a8ffexportZipToUriTb4b4b4(Te6edf3contextTb4b4b4: Te6edf3ContextTb4b4b4, Te6edf3targetUriTb4b4b4: Te6edf3UriTb4b4b4, Te6edf3dataTb4b4b4: Te6edf3ByteArrayTb4b4b4) Tff7b72= Te6edf3withContextTb4b4b4(Te6edf3ioDispatcherTb4b4b4) Tb4b4b4{
Tff7b72try Tb4b4b4{
Te6edf3contextTb4b4b4.Te6edf3contentResolverTb4b4b4.Te6edf3openOutputStreamTb4b4b4(Te6edf3targetUriTb4b4b4)Tff7b72?.Te6edf3use Tb4b4b4{ Te6edf3os Tff7b72-Tff7b72> Te6edf3osTb4b4b4.Te6edf3writeTb4b4b4(Te6edf3dataTb4b4b4) Tb4b4b4}
Te6edf3LoggerTb4b4b4.Te6edf3i Tb4b4b4{ Ta5d6ff"Ta5d6ffTAK data package exported successfully to Tffd700$Te6edf3targetUriTa5d6ff" Tb4b4b4}
Tb4b4b4} Tff7b72catch Tb4b4b4(Te6edf3eTb4b4b4: Te6edf3javaTb4b4b4.Te6edf3ioTb4b4b4.Te6edf3IOExceptionTb4b4b4) Tb4b4b4{
Te6edf3LoggerTb4b4b4.Te6edf3eTb4b4b4(Te6edf3eTb4b4b4) Tb4b4b4{ Ta5d6ff"Ta5d6ffFailed to export TAK data package to URI: Tffd700$Te6edf3targetUriTa5d6ff" Tb4b4b4}
Tb4b4b4}
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.04s